<!DOCTYPE html>
<html lang="en">

{include file="Public/head"}
<body data-type="widgets">
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

    {include file='Public:header'}
    {include file='Public:menu2'}



    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title  am-cf">自提点列表</div>
                        </div>
                        <div class="widget-body  am-fr">


                            <!--筛选搜索-->
                            <form action=""></form>

                            <form id="searchform" action="{:Url('pickup_search')}"  method="post" >
                                <table class="table">
                                    <tbody>
                                    <td >
                                        <div data-toggle="distpicker" id="target">
                                            <select class="input-sm" name="province" data-province="---- 选择省 ----"></select>
                                            <select class="input-sm" name="city" data-city="---- 选择市 ----"></select>
                                            <select class="input-sm" name="district" data-district="---- 选择区 ----"></select>
                                        </div>
                                    </td>

                                    <td  class="col-sm-3">
                                        <input type="text" class="form-control" value="{$Think.get.pickup_name}" placeholder="自提点名称" name="pickup_name">
                                    </td>

                                    <td>
                                    <div class="col-sm-12">
                                        <button class="btn btn-primary" type="submit" >搜索</button>
                                        <a href="{:url('pickup_list')}"><button type="button" id="loading-example-btn" class="btn btn-white btn-sm"><i class="fa fa-refresh"></i> 刷新</button></a>
                                    </div>
                                    </td>
                                    <td>
                                        <div class="form-group pull-right">
                                            <a href="{:url('pickup_add')}" class="btn btn-primary pull-right"><i class="fa fa-plus"></i>添加自提点</a>
                                        </div>
                                    </td>
                                    </tbody>
                                </table>
                            </form>
                            <div class="am-u-sm-12">
                                <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black " id="example-r">
                                    <thead>
                                    <tr>

                                        <th>自提点名称</th>
                                        <th>自提点地址</th>
                                        <th>自提点电话</th>
                                        <th>自提点联系人</th>
                                        <th>省</th>
                                        <th>市</th>
                                        <th>区</th>
                                        <th>供应商</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {foreach name="list" key="key" item="v"}
                                    <tr class="gradeX">
                                        <td>{$v.pickup_name}</td>
                                        <td>{$v.pickup_address}</td>
                                        <td>{$v.pickup_phone}</td>
                                        <td>{$v.pickup_contact}</td>
                                        <td>{$v.province}</td>
                                        <td>{$v.city}</td>
                                        <td>{$v.district}</td>
                                        <td>{if $v.suppliersid neq 0 }{$v.suppliers_name}{else}无供应商{/if}</td>
                                        <td>
                                            <div class="tpl-table-black-operation">
                                                <a href="{:Url('pickup_edit')}?pickup_id={$v.pickup_id}">
                                                    <i class="am-icon-pencil"></i> 编辑
                                                </a>
                                                <a onclick="del_button('{$v.pickup_id}');" href="javascript:void(0);" href="javascript:;" class="tpl-table-black-operation-del">
                                                    <i class="fa fa-trash-o"></i> 删除
                                                </a>
                                            </div>
                                        </td>
                                    </tr>
                                    {/foreach}
                                    <!-- more data -->
                                    </tbody>
                                </table>
                            </div>
                            <div class="am-u-lg-10 am-cf">

                                <div class="am-fr">
                                    <ul class="am-pagination tpl-pagination">
                                        {$list->render()}
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


</body>
{include file='Public:script'}
<link href="/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css">
<script src="/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="/daterangepicker/daterangepicker.js" type="text/javascript"></script>


<script src="/static/Distpicker/js/distpicker.data.js"></script>
<script src="/static/Distpicker/js/distpicker.js"></script>
<script src="/static/Distpicker/js/main.js"></script>

<script>
    $('#target').distpicker({
        autoSelect: false
    });
    // 删除按钮
    function del_button(id) {
        layer.confirm("确定删除？", {btn: ["确定","取消"], shade: 0.5}, function(){
            // 删除权限组
            $.post("{:url('del')}", {id: id}, function(res) {
                if (res.code != 200) {
                    layer.msg(res.msg, {shade: 0.5, time: 1000, icon: 2});
                    return false;
                }

                layer.msg(res.msg, {shade: 0.5, time: 1000, icon: 1}, function() {
                    layer.closeAll('page');
                    location.reload();
                });
            });
        }, function () {});
    }

</script>
</html>